#include <iostream>
using namespace std;
class Base
{
public:
    Base(int x, double y)
    {
        std::cout << "Base(" << x << ", " << y << ")\n";
    }
    Base(const char *s)
    {
        std::cout << "Base(\"" << s << "\")\n";
    }
};

class Derived : public Base
{
public:
    // 一行代码：把 Base 的所有构造函数全部继承
    using Base::Base;

    // 子类可以额外扩展自己的成员，不影响继承
    int extra;
    Derived(int x, double y, int extra) : Base(x, y), extra(extra)
    {
    }
};

int main()
{
    Derived d1(10, 3.14);    // 调用继承来的 Base(int,double)
    Derived d2("hello");     // 调用继承来的 Base(const char*)
    Derived d3(1, 2.0, 998); // 调用拓展的构造函数
    cout << d3.extra << endl;
    return 0;
}